/*
Disclaimer of Warranty: THE PACKAGE IS PROVIDED
BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS'
AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT
ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW.
UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF
THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(c) Copyright 2013 Edward Principe
All Rights Reserved

*/
#include "stdafx.h"
#include "tokex.h"

/////////////////////////////////////////////////////////////////
// PutErr: Assigns an error to the class
/////////////////////////////////////////////////////////////////
void TokEx::PutErr(TokErr err, unsigned long line, unsigned long col)
{
	// Get parameters
	_err = err;
	_line = line;
	_col = col;

	// Get severity and message
	switch (_err)
	{
	case(TERR_DUP_DEF) :
		_sev = SEV_ERROR;
		_msg = TEXT("Duplicate Definition");
		break;

	case(TERR_BAD_STRING) :
		_sev = SEV_ERROR;
		_msg = TEXT("Invalid String");
		break;

	case(TERR_SYNTAX) :
		_sev = SEV_ERROR;
		_msg = TEXT("Syntax Error");
		break;

	case(TERR_INTERNAL) :
		_sev = SEV_FATAL;
		_msg = TEXT("Internal Error");
		break;

	case(TERR_STRUCT_DEFINED) :
		_sev = SEV_ERROR;
		_msg = TEXT("Struct already defined");
		break;

	case(TERR_NONE) :
		_sev = SEV_MESSAGE;
		_msg = TEXT("No Error");
		break;

	default:
		_sev = SEV_FATAL;
		_msg = TEXT("Internal Error in TokEx::PutErr");
		break;
	}
}